<?php

namespace nimo\domains\acc\logic;

use DB;

class BooksValidator {
    protected $datas = null;
    protected $configs = null;
    protected $validator = null;
    protected $converter = null;
    protected $simpleInterceptor = null;
    protected static $_resources = null;
    public function __construct(array $datas, $configs = array()) {
        $this->datas = $datas;
        $this->configs = $configs;
    }
    public static function getRequire($path) {
        return require $path;
    }
    public function validate() {
        //static::$_resources = static::getRequire(__DIR__ . '/WakuDataCsvConfig.php');
        $sum = array('d_amount'=>0,'c_amount'=>0,);
        foreach ( $this->datas as &$d ) {
           foreach ( $sum as $s => $v ) {
               $sum[$s] += $d[$s];
           }
           echo json_encode($sum, JSON_UNESCAPED_UNICODE),"\n";
           if ($sum['d_amount'] == $sum['c_amount']) {
           echo "-------------\n";
        $sum = array('d_amount'=>0,'c_amount'=>0,);
           }
        }
    }
}

/*

php artisan app:domain acc book --path=./app/lib/src  --fields=./app/lib/stubs/nd/20140428_acc_tbook_table.txt --forced=on --nameprefix=no && php artisan migrate --path=.\app\lib\src\nimo\database\migrations && pause && php ./app/temp/batch.php

acc/master/code
acc/journal/entry

        '伝票連番' => 'required|digits_between:1,6',          // 0
        '伝票日付' => 'required|dateFormat:Y/m/d',            // 1
        '曜日' => null,                                       // 2
        '伝票番号' => 'required|digits_between:1,4',          // 5
        '仕訳連番' => 'required|digits_between:1,4',          // 10

 *
 */
